
var student_oclass = echarts.init(document.getElementById('student-oclass'));

option = {
    title: {
        text: '高三十班语数外各分数段人数'
      },
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross',
        crossStyle: {
          color: '#999'
        }
      }
    },
    toolbox: {
      feature: {
        dataView: { show: true, readOnly: false },
        magicType: { show: true, type: ['line', 'bar'] },
        restore: { show: true },
        saveAsImage: { show: true }
      }
    },
    legend: {
      data: ['语文', '数学', '外语']
    },
    xAxis: [
      {
        type: 'category',
        data: ['50', '75', '100', '110', '120', '130', '140','150'],
        axisPointer: {
          type: 'shadow'
        }
      }
    ],
    yAxis: [
      {
        type: 'value',
        name: 'score',
        min: 0,
        max: 50,
        interval: 10,
        axisLabel: {
          formatter: '{value}'
        }
      },
      {
        type: 'value',
        name: 'score',
        min: 0,
        max: 50,
        interval: 10,
        axisLabel: {
          formatter: '{value}'
        }
      }
    ],
    series: [
      {
        name: '语文',
        type: 'bar',
        tooltip: {
          valueFormatter: function (value) {
            return value ;
          }
        },
        data: [
          9, 13, 23, 0, 0, 0, 0, 0
        ]
      },
      {
        name: '数学',
        type: 'bar',
        tooltip: {
          valueFormatter: function (value) {
            return value ;
          }
        },
        data: [
          43, 2, 0, 0, 0, 0, 0, 0
        ]
      },
      {
        name: '外语',
        type: 'line',
        yAxisIndex: 1,
        tooltip: {
          valueFormatter: function (value) {
            return value ;
          }
        },
        data: [14, 20, 10, 1, 0, 0, 0, 0, 0]
      }
    ]
  };

  // 使用刚指定的配置项和数据显示图表。
  student_oclass.setOption(option);